"""
猜数字
"""
from random import *
secretNumber = randint(1, 20)
# print(secretNumber)
print('猜一个1-20之间的整数。')
print('开始猜:')
for i in range(1, 7):
    try:
        guess = int(input())
    except ValueError:
        print('输入有误！')
        continue
    if guess < secretNumber:
        print('你猜的数小了！')
    elif guess > secretNumber:
        print('你猜的数大了！')
    else:
        break

if guess == secretNumber:
    print('猜对了！')
else:
    print('很遗憾，秘密数字是:', str(secretNumber))



